<template>
    <div id="system" class="warp system">
        <postHead active="home" :showAction="true"></postHead>

        <div class="container">
            <div class="addjob wrap_panel">
                <div class="panel panel-default">
                    <div class="panel-heading">新增岗位</div>
                    <div class="panel-body">

                        <!-- 新增岗位 -->
                        <div class="register-info">
                            <form class="form-horizontal">


                                <div class="register-tag">悬赏金额</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">金额</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width: 200px;"
                                            class="form-control" placeholder="请输入悬赏金额"
                                            v-model="form.infoRewardSet.money">
                                        <span style="margin-left:5px">元</span>

                                        <!-- <i class="el-icon-question" style="margin-left: 5px;color: #888888;cursor: pointer;font-size:20px"></i> -->

                                        <el-popover placement="right-start" width="600" title="悬赏金规则" trigger="click">
                                            <div class="rule_content" v-html="contentMain">

                                            </div>
                                            <span style="color:#409EFF;margin-left:10px;cursor: pointer;"
                                                slot="reference">悬赏金规则</span>
                                        </el-popover>
                                    </div>
                                </div>
                                <div class="register-tag">基本信息</div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>工作地点</label>

                                    <div class="register-form-control">
                                        <template v-for="(item, index) in workSelect">
                                            <div class="addmain">


                                                <el-select v-model="item.first" style="width: 140px;" filterable
                                                    @change="changeWorkFirst(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in workPlaceList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.second" style="width: 140px;margin-left: 10px;"
                                                    filterable @change="changeWorkSecond(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.secondWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.third" filterable
                                                    @change="changeWorkThird(item)"
                                                    style="width: 140px;margin-left: 10px;" placeholder="请选择或搜索">

                                                    <el-option-group v-for="group in item.thirdWorkList"
                                                        :key="group.initial" :label="group.initial">
                                                        <el-option v-for="json in group.list" :key="json.id"
                                                            :label="json.name" :value="json.id">
                                                        </el-option>
                                                    </el-option-group>

                                                </el-select>


                                                <el-select v-model="item.fourth" style="width: 140px;margin-left: 10px;"
                                                    filterable placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.fourthWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>



                                                <div class="add_btn" @click="addWork" v-if="index == workSelect.length - 1">
                                                    <span>+</span>
                                                </div>

                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(workSelect, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                            </div>
                                        </template>

                                    </div>

                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>招聘数量</label>
                                    <div class="register-form-control">
                                        <input type="number" v-model="form.num" placeholder="请输入招聘数量"
                                            class="form-control">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>招聘原因
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.reason" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in dictInfo.reason" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>紧急程度
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.urgency" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in dictInfo.urgency" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>








                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位名称
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入岗位名称"
                                            v-model="form.name">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>岗位图片
                                    </label>
                                    <div class="register-form-control">
                                        <a class="BusinessLicense" v-if="form.postImg"> <img :src="form.postImgUrl"
                                                style="height: 90px; width: 160px">
                                            <span @click="deleteImg">删除</span></a>

                                        <div class="upload_div">
                                            <i class="el-icon-plus"></i>
                                            <input type="file" accept="image/*" @change="changeFile">
                                        </div>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>岗位标语
                                    </label>
                                    <div class="register-form-control"
                                        style="border: 1px solid #e6e6e6;width: 400px;margin-left: 15px;">

                                        <Toolbar style="border-bottom: 1px solid #ccc" :editor="editor"
                                            :defaultConfig="toolbarConfig" :mode="mode" />
                                        <Editor style="height: 60px; overflow-y: hidden" v-model="form.jobSlogan"
                                            @onCreated="onCreated" :defaultConfig="editorConfig" :mode="mode" />

                                        <!-- <input id="jobname" type="text" class="form-control" placeholder="请输入岗位标语" v-model="form.jobSlogan"> -->

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位类型
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.postType" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in dictInfo.postType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>所属公司
                                    </label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.companyId" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in companyList" :key="item.id" :label="item.name"
                                                :value="item.id">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>所属部门
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入所属部门"
                                            v-model="form.department">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>部门介绍
                                    </label>
                                    <div class="register-form-control">
                                        <textarea class="form-control" placeholder="请输入部门介绍"
                                            v-model="form.departmentIntroduction"></textarea>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位职级
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.positionRank" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>所属职能
                                    </label>
                                    <div class="register-form-control">
                                        <el-cascader placeholder="请选择或搜索职能" v-model="form.functionalAffiliation"
                                            :options="functionalAffiliationList" :collapse-tags="true"
                                            style="width: 400px;" filterable :props="props" clearable>
                                        </el-cascader>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>直接上级职级
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.directSuperiorRank" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>直接上级简介
                                    </label>
                                    <div class="register-form-control">
                                        <textarea class="form-control" placeholder="请输入直接上级简介"
                                            v-model="form.directSuperiorIntroduction"></textarea>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>下属情况
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入下属情况"
                                            v-model="form.subordinateSituation">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>平级岗位
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入平级岗位"
                                            v-model="form.equalPost">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>岗位职责</label>
                                    <div class="register-form-control"
                                        style="border: 1px solid #e6e6e6;width: 400px;margin-left: 15px;">
                                        <!-- <textarea rows="10" class="form-control jobdesc" placeholder="请输入岗位职责" id="jobdesc" v-model="form.jobDescription"></textarea> -->


                                        <Toolbar style="border-bottom: 1px solid #ccc" :editor="editorNext"
                                            :defaultConfig="toolbarConfig" :mode="mode" />
                                        <Editor style="height: 350px; overflow-y: hidden" v-model="form.jobDescription"
                                            @onCreated="onCreatedNext" :defaultConfig="editorConfig" :mode="mode" />




                                    </div>
                                </div>

                                <div class="register-tag">薪资待遇</div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>税前年薪合计</label>
                                    <div class="register-form-control">

                                        <input id="jobname" type="number" style="width: 150px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxAnnualSalaryStart">
                                        至

                                        <input id="jobname" type="number" style="width: 150px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxAnnualSalaryEnd">

                                        万元
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>其中、税前月薪</label>
                                    <div class="register-form-control">

                                        <input id="jobname" type="number" style="width: 150px;" class="form-control"
                                            placeholder="请输入税前月薪" v-model="form.preTaxMonthlySalaryStart">
                                        K 至

                                        <input id="jobname" type="number" style="width: 150px;" class="form-control"
                                            placeholder="请输入税前月薪" v-model="form.preTaxMonthlySalaryEnd">

                                        K
                                        <!-- <input id="jobname" type="number"  class="form-control" placeholder="请输入税前月薪" v-model="form.preTaxMonthlySalary"> -->
                                    </div>
                                </div>

                                <!-- <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>年终奖金约</label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="number"  class="form-control" placeholder="请输入年终奖金约" v-model="form.yearEndBonus">
                                    </div>
                                </div> -->


                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>补贴福利</label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入补贴福利"
                                            v-model="form.subsidyWelfare">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>股权激励情况</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.equityIncentive" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option v-for="item in dictInfo.equityIncentive" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>作息时间</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.workTime" placeholder="请选择" style="width: 400px;">
                                            <el-option v-for="item in dictInfo.workTime" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>出差频率</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.travelFrequency" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option v-for="item in dictInfo.travelFrequency" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>





                                <div class="register-tag">学历/专业等要求</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>年龄要求</label>
                                    <div class="register-form-control ">
                                        <input id="AgeNeed" type="number" placeholder="最小年龄" v-model="form.ageStart"
                                            class="form-control" style="width: auto;"> <span>-</span>
                                        <input id="AgeNeed2" type="number" placeholder="最大年龄" v-model="form.ageEnd"
                                            class="form-control" style="width: auto;">
                                        <span style="margin-left:10px">岁</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>最低学历要求</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.lowestAcademic" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option v-for="item in dictInfo.qualification" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <span style="margin-left:10px">及以上</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>其中:本科要求</label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.universityType" multiple placeholder="请选择本科学校类别"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.universityQualificationType" placeholder="请选择本科学历类别"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>




                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>硕士要求</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.masterSchoolType" multiple placeholder="请选择硕士学校类别"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.masterQualificationType" placeholder="请选择硕士学历类别"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>



                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>博士要求</label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.doctorSchoolType" multiple placeholder="请选择博士学校类别"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.doctorQualificationType" placeholder="请选择博士学历类别"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">希望来自学校</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control" placeholder="不限"
                                            v-model="form.fromSchool">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">专业要求</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control" placeholder="不限"
                                            v-model="form.professionalRequirements">
                                    </div>
                                </div>
                                <div class="register-tag">证书要求</div>


                                <div class="form-group">
                                    <label class="register-form-label control-label">同时持有证书</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control"
                                            placeholder='可多个，用"，"分隔' v-model="form.certificateOne">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">或持有证书</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control"
                                            placeholder='可多个，用"，"分隔' v-model="form.certificateTwo">
                                    </div>
                                </div>

                                <div class="register-tag">语言要求</div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">具备以下语言能力</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.languageAbilityOne" placeholder="请选择语言"
                                            style="width: 195px;">
                                            <el-option v-for="item in dictInfo.language" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.languageOneRequirements" placeholder="请选择语言要求"
                                            style="width: 195px;margin-left: 10px;">
                                            <el-option v-for="item in dictInfo.languageAbility" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label">或具备以下语言能力</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.languageAbilityTwo" placeholder="请选择语言"
                                            style="width: 195px;">
                                            <el-option v-for="item in dictInfo.language" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.languageTwoRequirements" placeholder="请选择语言要求"
                                            style="width: 195px;margin-left: 10px;">
                                            <el-option v-for="item in dictInfo.languageAbility" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </div>
                                </div>

                                <div class="register-tag">地点要求</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">现工作地要求</label>
                                    <div class="register-form-control">


                                        <template v-for="(item, index) in currentWorkplaceRequirementsSelect">
                                            <div class="addmain">


                                                <el-select v-model="item.first" style="width: 140px;" filterable
                                                    @change="changeWorkFirst(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in workPlaceList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.second" style="width: 140px;margin-left: 10px;"
                                                    filterable @change="changeWorkSecond(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.secondWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.third" filterable
                                                    @change="changeWorkThird(item)"
                                                    style="width: 140px;margin-left: 10px;" placeholder="请选择或搜索">

                                                    <el-option-group v-for="group in item.thirdWorkList"
                                                        :key="group.initial" :label="group.initial">
                                                        <el-option v-for="json in group.list" :key="json.id"
                                                            :label="json.name" :value="json.id">
                                                        </el-option>
                                                    </el-option-group>

                                                </el-select>


                                                <el-select v-model="item.fourth" style="width: 140px;margin-left: 10px;"
                                                    filterable placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.fourthWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>




                                                <div class="add_btn"
                                                    v-if="index == currentWorkplaceRequirementsSelect.length - 1"
                                                    @click="addCurrentWork">
                                                    <span>+</span>
                                                </div>
                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(currentWorkplaceRequirementsSelect, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                            </div>
                                        </template>


                                        <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.currentWorkplaceRequirements"> -->
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">曾经工作地要求</label>
                                    <div class="register-form-control">

                                        <template v-for="(item, index) in previousWorkplaceRequirementsSelect">
                                            <div class="addmain">


                                                <el-select v-model="item.first" style="width: 140px;" filterable
                                                    @change="changeWorkFirst(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in workPlaceList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.second" style="width: 140px;margin-left: 10px;"
                                                    filterable @change="changeWorkSecond(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.secondWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.third" filterable
                                                    @change="changeWorkThird(item)"
                                                    style="width: 140px;margin-left: 10px;" placeholder="请选择或搜索">

                                                    <el-option-group v-for="group in item.thirdWorkList"
                                                        :key="group.initial" :label="group.initial">
                                                        <el-option v-for="json in group.list" :key="json.id"
                                                            :label="json.name" :value="json.id">
                                                        </el-option>
                                                    </el-option-group>

                                                </el-select>


                                                <el-select v-model="item.fourth" style="width: 140px;margin-left: 10px;"
                                                    filterable placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.fourthWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <div class="add_btn"
                                                    v-if="index == previousWorkplaceRequirementsSelect.length - 1"
                                                    @click="addPreviousWork">
                                                    <span>+</span>
                                                </div>
                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(previousWorkplaceRequirementsSelect, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                            </div>
                                        </template>

                                        <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.previousWorkplaceRequirements"> -->
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">定居要求</label>
                                    <div class="register-form-control">
                                        <template v-for="(item, index) in settlementRequirementsSelect">
                                            <div class="addmain">


                                                <el-select v-model="item.first" style="width: 140px;" filterable
                                                    @change="changeWorkFirst(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in workPlaceList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.second" style="width: 140px;margin-left: 10px;"
                                                    filterable @change="changeWorkSecond(item)" placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.secondWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>


                                                <el-select v-model="item.third" filterable
                                                    @change="changeWorkThird(item)"
                                                    style="width: 140px;margin-left: 10px;" placeholder="请选择或搜索">

                                                    <el-option-group v-for="group in item.thirdWorkList"
                                                        :key="group.initial" :label="group.initial">
                                                        <el-option v-for="json in group.list" :key="json.id"
                                                            :label="json.name" :value="json.id">
                                                        </el-option>
                                                    </el-option-group>

                                                </el-select>


                                                <el-select v-model="item.fourth" style="width: 140px;margin-left: 10px;"
                                                    filterable placeholder="请选择或搜索">
                                                    <el-option v-for="json in item.fourthWorkList" :key="json.id"
                                                        :label="json.name" :value="json.id">
                                                    </el-option>
                                                </el-select>

                                                <div class="add_btn" v-if="index == settlementRequirementsSelect.length - 1"
                                                    @click="addSettlementWork">
                                                    <span>+</span>
                                                </div>
                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(settlementRequirementsSelect, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                            </div>
                                        </template>

                                        <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.settlementRequirements"> -->
                                    </div>
                                </div>






                                <div class="register-tag">行业、岗位经验整体要求</div>


                                <div class="form-group">
                                    <label class="register-form-label control-label">工作</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width: 195px;"
                                            class="form-control" placeholder="不限"
                                            v-model="form.infoExperienceRequirements.workYear">
                                        年以上

                                    </div>

                                </div>
                                <template v-for="(json, index) in form.infoExperienceRequirements.item">
                                    <div class="form-group">
                                        <label class="register-form-label control-label" v-if="index == 0">其中从事:</label>
                                        <label class="register-form-label control-label" v-if="index != 0">
                                            <el-select v-model="json.conditionStr" placeholder=""
                                                @change="changeWorkLink" v-if="index != 0"
                                                style="width: 60px;margin-right: 18px;">
                                                <el-option label="或" value="or">
                                                </el-option>
                                                <el-option label="且" value="and">
                                                </el-option>
                                            </el-select>
                                            从事:
                                        </label>
                                        <div class="register-form-control">
                                            <div class="addmain" style="margin-top: 0px;">


                                                <el-cascader v-model="json.industry" :options="enterpriseIndustry"
                                                    style="width: 150px;" :collapse-tags="true" filterable
                                                    :props="props" placeholder="请选择或搜索行业" clearable>
                                                </el-cascader>
                                                <el-cascader v-model="json.functionalAffiliation"
                                                    :options="functionalAffiliationList" :collapse-tags="true"
                                                    filterable style="width: 160px;margin-left: 10px;" :props="props"
                                                    placeholder="请选择或搜索职能" clearable>
                                                </el-cascader>
                                                <el-select v-model="json.positionRank" multiple placeholder="请选择职级"
                                                    style="width: 160px;margin-left: 10px;">
                                                    <el-option label="不限" value="">
                                                    </el-option>
                                                    <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                        :label="item.label" :value="item.value">
                                                    </el-option>
                                                </el-select>

                                                <input id="professionalneed" style="width: 95px;margin-left: 10px;"
                                                    type="number" class="form-control" placeholder="不限"
                                                    v-model="json.engagedYear"><span style="margin-left:10px">年以上</span>

                                                <div class="add_btn"
                                                    v-if="index == form.infoExperienceRequirements.item.length - 1"
                                                    @click="addInfoExperienceRequirements" style="margin-left: 10px;">
                                                    <span>+</span>
                                                </div>
                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(form.infoExperienceRequirements, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                            </div>
                                        </div>
                                    </div>


                                </template>
                                <div class="form-group">
                                    <label class="register-form-label control-label">目前年薪不低于</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width:200px"
                                            class="form-control"
                                            v-model="form.infoExperienceRequirements.annualSalaryNotLess">
                                        <span style="margin-left: 10px;">万元</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">职业稳定度</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.wendingdu" placeholder="请选择职业稳定度"
                                            style="width: 400px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option label="最长单位工作5年以上" value="1">
                                            </el-option>
                                            <el-option label="最长单位工作8年以上" value="2">
                                            </el-option>
                                            <el-option label="最长单位工作10年以上" value="3">
                                            </el-option>
                                            <el-option label="近5年单位不超2家" value="4">
                                            </el-option>
                                            <el-option label="近5年单位不超3家" value="5">
                                            </el-option>
                                            <el-option label="平均工作年限3年以上" value="6">
                                            </el-option>
                                            <el-option label="平均工作年限4年以上" value="7">
                                            </el-option>
                                            <el-option label="平均工作年限5年以上" value="8">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">其他要求</label>
                                    <div class="register-form-control">
                                        <div class="register-form-control"
                                            style="border: 1px solid #e6e6e6;width: 400px;margin-left: 0px;">
                                            <!-- <textarea rows="10" class="form-control jobdesc" placeholder="请输入岗位职责" id="jobdesc" v-model="form.jobDescription"></textarea> -->


                                            <Toolbar style="border-bottom: 1px solid #ccc" :editor="editorNextThree"
                                                :defaultConfig="toolbarConfig" :mode="mode" />
                                            <Editor style="height: 350px; overflow-y: hidden"
                                                v-model="form.infoExperienceRequirements.otherRequirements"
                                                @onCreated="onCreatedNextThree" :defaultConfig="editorConfig"
                                                :mode="mode" />




                                        </div>
                                    </div>
                                </div>
                                <template v-for="(json, index) in form.infoJobRequirementsKeyUnit">

                                    <div class="register-tag" style="justify-content:space-between">
                                        <div class="left_div">
                                            关键单位、岗位任职要求：
                                        </div>

                                        <div class="right_div">
                                            <div class="add_btn" @click="addInfoJobRequirementsKeyUnit"
                                                style="margin-left: 10px;float:right"
                                                v-if="index == form.infoJobRequirementsKeyUnit.length - 1">
                                                <span>+</span>
                                            </div>
                                            <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0"> <span
                                                    @click="deleteWork(form.infoJobRequirementsKeyUnit, index)"
                                                    style="color: #F5792A;">删除</span></a>
                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">近</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="number"
                                                style="width: 50px;margin-right:10px;" class="form-control"
                                                placeholder="" v-model="json.inRecentYear">年内，




                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">在目标企业</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="text" class="form-control"
                                                placeholder="多个用,隔开" v-model="json.company">




                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">或在</label>
                                        <div class="register-form-control">

                                            <!--  -->
                                            <el-cascader v-model="json.enterpriseIndustry" :options="enterpriseIndustry"
                                                :collapse-tags="true" style="width: 195px;" filterable
                                                placeholder="请选择或搜索行业" :props="props" clearable>
                                            </el-cascader>


                                            <el-select v-model="json.enterpriseScale" multiple placeholder="请选择企业规模"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseScale" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <el-select v-model="json.enterpriseNature" multiple placeholder="请选择企业性质"
                                                style="width: 195px;margin-left: 10px;">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseNature" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>

                                            <el-select v-model="json.listingType" multiple placeholder="请选择上市类型"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.listingType" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">企业人数不低于</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="number" style="width:195px"
                                                class="form-control" placeholder="请输入人数" v-model="json.staffsNum">
                                            <span style="margin-left:10px">企业营收(产能)不低于</span>

                                            <input id="professionalneed" type="number" class="form-control"
                                                style="width:195px;margin-left:10px" placeholder="企业营收(产能)"
                                                v-model="json.annualRevenue"><span style="margin-left:10px">万元</span>

                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">从事:</label>
                                        <div class="register-form-control">

                                            <el-cascader v-model="json.functionalAffiliation"
                                                :options="functionalAffiliationList" style="width: 195px;"
                                                :collapse-tags="true" filterable :props="props" placeholder="请选择或搜索职能"
                                                clearable>
                                            </el-cascader>
                                            <span style="margin-left:10px">管理人数不低于</span>
                                            <input id="professionalneed" type="number"
                                                style="width:95px;margin-left:10px" class="form-control"
                                                placeholder="不限" v-model="json.numberManagers">
                                            <span style="margin-left:10px">人</span>

                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="register-form-label control-label">担任:</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="text" style="width: 195px;"
                                                class="form-control" placeholder="担任职务，多个用,隔开"
                                                v-model="json.positionHeld">
                                            <el-select v-model="json.rank" multiple placeholder="请选择职级"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <input id="professionalneed" type="number"
                                                style="width: 50px;margin:0 10px;" class="form-control" placeholder=""
                                                v-model="json.workYear">
                                            <span>年以上</span>

                                        </div>
                                    </div>

                                </template>
                                <!-- 
                                <div class="add_list">
                                    
                                </div> -->


                                <div class="register-tag">保密设置</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">匿名发布</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.infoSecrecy.anonymouslyPublish" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option v-for="item in dictInfo.yn" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label">目前在职</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" class="form-control" placeholder="请填写公司名称"
                                            v-model="form.infoSecrecy.notCompanyCurrentlyEmployed">
                                        <span style="margin-left:10px">公司的求职者不能检索、投递</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">曾经在职</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" class="form-control" placeholder="请填写公司名称"
                                            v-model="form.infoSecrecy.notCompanyPreviouslyEmployed">
                                        <span style="margin-left:10px">公司的求职者不能检索、投递</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">对</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.infoSecrecy.publiclyAccounts" placeholder="请选择"
                                            style="width: 400px;">
                                            <el-option label="全部" value="">

                                            </el-option>

                                            <!-- <el-option
                                            v-for="item in dictInfo.yn"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                            </el-option> -->
                                        </el-select>
                                        <span style="margin-left:10px">子账户公开</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">岗位招聘负责人</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control"
                                            placeholder="请输入岗位招聘负责人" v-model="form.jobRecruitmentManager">
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="register-action">
                            <input type="button" value="保存岗位" class="btn btn-primary btn-lg savejob"
                                @click="savePost('2')">
                            <input type="button" value="保存且发布" class="btn btn-primary btn-lg savepublishjob"
                                @click="savePost('1')" style="margin-left:30px">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>

import postHead from '@/components/postHead.vue';
import homeapi from '@/api/api.js'
import until from '@/api/until'
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
export default {
    name: 'login',
    data() {
        return {
            phone: "",
            haveCheck: false,
            code: "",
            title: "",
            loginType: 1,
            loginCode: 1,
            active: 2,

            editorConfig: {

            },
            mode: "default", // 'default' or 'simple'
            editor: null,
            editorNext: null,
            editorNextThree: null,

            toolbarConfig: {
                toolbarKeys: [//自定义菜单选项，显示的选项

                    "bold",

                    "bgColor",
                ],
                excludeKeys: [//隐藏掉的选项

                    "sub",
                    "sup",
                ],
            },


            workSelect: [

            ],
            previousWorkplaceRequirementsSelect: [],
            settlementRequirementsSelect: [],
            form: {
                jobSlogan: "",
                postImg: "",
                postImgUrl: "",
                name: "",
                postType: "1",
                num: "",
                reason: "",
                urgency: "",
                companyId: "",
                companyName: "",
                department: "",
                departmentIntroduction: "",
                positionRank: "",
                functionalAffiliation: "",
                directSuperiorRank: "",
                directSuperiorIntroduction: "",
                subordinateSituation: "",
                equalPost: "",
                preTaxAnnualSalaryEnd: "",
                preTaxAnnualSalaryStart: "",
                preTaxMonthlySalaryStart: '',
                preTaxMonthlySalaryEnd: "",
                yearEndBonus: "",
                subsidyWelfare: "",
                equityIncentive: "",
                workTime: "2",
                travelFrequency: "",
                workPlace: [],
                workPlaceList: [],
                jobDescription: "",
                ageStart: "",
                ageEnd: "",
                lowestAcademic: "",
                jcType: [],
                jcQualificationType: "",
                universityType: [],
                universityQualificationType: "",
                masterSchoolType: [],
                masterQualificationType: "",
                doctorSchoolType: [],
                doctorQualificationType: "",
                fromSchool: "",
                professionalRequirements: "",
                certificateOne: "",
                certificateTwo: "",
                languageAbilityOne: "",
                languageOneRequirements: "",
                languageAbilityTwo: "",
                languageTwoRequirements: "",
                currentWorkplaceRequirements: [],
                previousWorkplaceRequirements: [],
                settlementRequirements: [],
                jobRecruitmentManager: "",
                infoRewardSet: {
                    money: 0,
                },
                infoSecrecy: {
                    anonymouslyPublish: "0",
                    constituentCompanyId: "",
                    notCompanyCurrentlyEmployed: "",
                    notCompanyPreviouslyEmployed: "",
                    publiclyAccounts: "",
                },
                infoExperienceRequirements: {

                    annualSalaryNotLess: "",
                    careerStability: "",
                    otherRequirements: "",
                    workYear: '',
                    item: [
                        {
                            conditionStr: "",
                            engagedYear: "",
                            functionalAffiliation: [],
                            industry: [],
                            positionRank: [],
                        }
                    ]

                },
                infoJobRequirementsKeyUnit: [
                    {
                        annualRevenue: "",
                        company: "",
                        engagedIn: "",
                        enterpriseIndustry: [],
                        enterpriseNature: [],
                        enterpriseScale: [],
                        functionStr: "",
                        inRecentYear: "",
                        listingType: "",
                        numberManagers: "",
                        positionHeld: "",
                        rank: "",
                        staffsNum: "",
                        workYear: "",
                    }
                ],
                infoOther: {
                    attachment: "",
                    soundRecording: "",
                },
                status: "",


            },
            currentWorkplaceRequirementsSelect: [],
            userForm: {
                inviteCode: "",
                inviter: "",
                inviterPhone: "",
                name: "",
                nickName: "",
                workplace: "",
                idCard: "",
                personHighestDegree: {

                },
                personImportantUnits: {

                }
            },
            enterpriseScaleList: [],
            enterpriseIndustry: [],
            enterpriseNatureList: [],
            staffsNumList: [],


            cateProps: {
                value: "value",
                label: "label",
                children: "children",
            },
            props: {
                value: "id",
                label: "text",
                children: "children",
                multiple: true,

            },
            workProps: {
                value: "id",
                label: "name",
                children: "child",
                multiple: true,
                lazy: true,
                lazyLoad(node, resolve) {

                    //const { level } = node;
                    // setTimeout(() => {
                    //     const nodes = Array.from({ length: level + 1 })
                    //         .map(item => ({
                    //         value: ++id,
                    //         label: `选项${id}`,
                    //         leaf: level >= 2
                    //         }));

                    //     resolve(nodes);
                    // }, 1000);
                }
            },
            showCode: true,
            time: 60,
            dictInfo: {},

            functionalAffiliationList: [],
            companyList: [],

            workPlaceList: [],
            workPlaceSecondList: [],
            contentMain: ''



        }
    },
    components: {
        postHead, Editor, Toolbar
    },
    mounted() {
        let title = this.$route.query.title
        if (title) {
            this.title = title
        }
        else {
            this.title = "AI爱招聘-注册"
        }
        this.getDictList();
        this.getIndustryList();
        this.getFunctionalffiliationList();
        this.getCompanyInfo();
        this.getChildCompanyList();
        this.getWorkSpace();
        this.getContentType();
        // this.getChinaCountry();
    },
    methods: {
        async getContentType() {
            let type = 1;
            const data = await homeapi.getContentType({ type });
            if (data.code == 200) {
                this.contentMain = data.result.content
            }

        },
        deleteWork(worklist, index) {
            worklist.splice(index, 1)
        },

        addInfoExperienceRequirements() {
            this.form.infoExperienceRequirements.item.push({
                engagedYear: "",
                functionalAffiliation: "",
                industry: "",
                positionRank: "",
                workYear: "",
                conditionStr: 'or'
            })
        },
        addInfoJobRequirementsKeyUnit() {
            this.form.infoJobRequirementsKeyUnit.push({
                annualRevenue: "",
                company: "",
                engagedIn: "",
                enterpriseIndustry: [],
                enterpriseNature: "",
                enterpriseScale: "",
                functionStr: "",
                inRecentYear: "",
                listingType: "",
                numberManagers: "",
                positionHeld: "",
                rank: "",
                staffsNum: "",
                workYear: "",
            })
        },
        addWork() {
            this.workSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
            })
            this.changeWorkSecond(this.workSelect[this.workSelect.length - 1])
        },
        addCurrentWork() {
            this.currentWorkplaceRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
            })
            this.changeWorkSecond(this.currentWorkplaceRequirementsSelect[this.currentWorkplaceRequirementsSelect.length - 1])
        },
        addPreviousWork() {
            this.previousWorkplaceRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
            })
            this.changeWorkSecond(this.previousWorkplaceRequirementsSelect[this.previousWorkplaceRequirementsSelect.length - 1])
        },
        addSettlementWork() {
            this.settlementRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
            })
            this.changeWorkSecond(this.settlementRequirementsSelect[this.settlementRequirementsSelect.length - 1])
        },
        onCreated(editor) {
            this.editor = Object.seal(editor); // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项
                    "fontSize",
                    "bold",

                    "color",
                    "bgColor",
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },
        onCreatedNext(editor) {
            this.editorNext = Object.seal(editor); // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项


                    "fontSize",
                    "bold",

                    "color",
                    "bgColor",
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },
        onCreatedNextThree(editor) {
            this.editorNextThree = Object.seal(editor); // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项


                    "fontSize",
                    "bold",

                    "color",
                    "bgColor",
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },




        //选择第一个地点
        changeWorkFirst(item) {
            this.workPlaceList.map(res => {
                if (res.id == item.first) {
                    item.secondWorkList = res.child
                }
            })
        },
        //选择第二个点
        async changeWorkSecond(item) {
            console.log(item)
            let data = await homeapi.getCountryList({ id: item.second });
            if (data.code == 200) {

                item.thirdWorkList = data.result;
            }
        },
        //选择第三个点
        async changeWorkThird(item) {
            let data = await homeapi.getCityList({ id: item.third })
            if (data.code == 200) {
                item.fourthWorkList = data.result;
            }
        },

        //获取工作地点
        async getWorkSpace() {
            let data = await homeapi.getWorkSpaceList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name
                    res.children = res.child
                    if (res.child) {
                        res.child.map(json => {
                            json.text = json.name

                        })
                    }

                })
                console.log(data.result)
                this.workPlaceList = data.result
                if (this.workPlaceList.length > 0) {
                    this.workSelect.push(
                        {
                            first: this.workPlaceList[0].id,
                            secondWorkList: this.workPlaceList[0].child,
                            second: this.workPlaceList[0].child[0].id,
                            thirdWorkList: [],
                            third: "",
                            fourthWorkList: [],
                            fourth: "",
                        }
                    )
                    this.currentWorkplaceRequirementsSelect.push({
                        first: this.workPlaceList[0].id,
                        secondWorkList: this.workPlaceList[0].child,
                        second: this.workPlaceList[0].child[0].id,
                        thirdWorkList: [],
                        third: "",
                        fourthWorkList: [],
                        fourth: "",
                    })

                    this.previousWorkplaceRequirementsSelect.push({
                        first: this.workPlaceList[0].id,
                        secondWorkList: this.workPlaceList[0].child,
                        second: this.workPlaceList[0].child[0].id,
                        thirdWorkList: [],
                        third: "",
                        fourthWorkList: [],
                        fourth: "",
                    })
                    this.settlementRequirementsSelect.push({
                        first: this.workPlaceList[0].id,
                        secondWorkList: this.workPlaceList[0].child,
                        second: this.workPlaceList[0].child[0].id,
                        thirdWorkList: [],
                        third: "",
                        fourthWorkList: [],
                        fourth: "",
                    })
                    this.changeWorkSecond(this.workSelect[0])
                    this.changeWorkSecond(this.previousWorkplaceRequirementsSelect[0])
                    this.changeWorkSecond(this.currentWorkplaceRequirementsSelect[0])
                    this.changeWorkSecond(this.settlementRequirementsSelect[0])
                }

            }
        },
        //获取中国的城市
        async getChinaCountry() {

        },

        async changeFile(e) {
            if (e.target.files.length > 0) {
                let file = e.target.files[0]
                var formData = new FormData();

                formData.append('file', file);
                let data = await homeapi.uploadFile(formData)

                if (data.code == 200) {

                    this.form.postImgUrl = data.result.url
                    this.form.postImg = data.result.path
                    console.log(this.form)
                }
            }

        },


        //获取公司信息
        async getCompanyInfo() {
            let data = await homeapi.getCompanyInfo();
            if (data.code == 200) {
                this.companyInfo = data.result
                this.form.companyName = this.companyInfo.name
                this.form.companyId = this.companyInfo.id
                this.form.jobRecruitmentManager = this.companyInfo.contactName
            }
        },
        //获取子公司信息
        async getChildCompanyList() {
            let data = await homeapi.getCompanyList();
            if (data.code == 200) {
                this.companyList = data.result
            }
        },

        async savePost(status) {
            let form = this.form;
            form.workPlace = [];
            form.currentWorkplaceRequirements = []
            form.previousWorkplaceRequirements = [];
            form.settlementRequirements = [];
            this.workSelect.map(res => {
                if (res.fourth) {
                    form.workPlace.push(res.fourth)
                }
                else if (res.third) {
                    form.workPlace.push(res.third)
                }


            })
            this.currentWorkplaceRequirementsSelect.map(res => {
                if (res.fourth) {
                    form.currentWorkplaceRequirements.push(res.fourth)
                }
                else if (res.third) {
                    form.currentWorkplaceRequirements.push(res.third)
                }
            })


            this.previousWorkplaceRequirementsSelect.map(res => {
                if (res.fourth) {
                    form.previousWorkplaceRequirements.push(res.fourth)
                }
                else if (res.third) {
                    form.previousWorkplaceRequirements.push(res.third)
                }
            })

            this.settlementRequirementsSelect.map(res => {
                if (res.fourth) {
                    form.settlementRequirements.push(res.fourth)
                }
                else if (res.third) {
                    form.settlementRequirements.push(res.third)
                }
            })
            form.status = status
            let data = await homeapi.addPost(form)
            if (data.code == 200) {
                this.$message.success("操作成功")
                this.$router.push("/")
            }
        },

        toLogin() {
            this.$router.push("/login/loginnew")
        },
        setActive(type) {
            this.active = type;
        },
        //获取数据字典
        async getDictList() {
            let data = await homeapi.getDictList();
            if (data.code == 200) {
                this.dictInfo = data.result
            }
        },
        deleteImg() {
            this.form.postImg = ""
            this.form.postImgUrl = ""
        },
        //获取职能列表
        async getFunctionalffiliationList() {
            let data = await homeapi.getFunctionList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name;
                    if (res.child.length > 0) {
                        res.child.map(json => {
                            json.text = json.name
                        })
                        res.children = res.child;
                        res.children.map(json => {
                            if (json.child.length > 0) {
                                json.child.map(item => {
                                    item.text = item.name
                                })
                                json.children = json.child

                            }

                        })
                    }

                })
                this.functionalAffiliationList = data.result
            }
        },

        //获取行业列表
        async getIndustryList() {
            let data = await homeapi.getIndustryList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name;
                    if (res.child.length > 0) {
                        res.child.map(json => {
                            json.text = json.name
                        })
                        res.children = res.child;
                        res.children.map(json => {
                            if (json.child.length > 0) {
                                json.child.map(item => {
                                    item.text = item.name
                                })
                                json.children = json.child

                            }

                        })
                    }

                })

                this.enterpriseIndustry = data.result

            }
        },




        async sendCode() {
            let phone = this.phone
            if (phone.length != 11) {
                this.$message.error("请传入正确的手机号")
                return false;
            }

            let data = await homeapi.sendCode({ phone });

            if (data.code == 200) {
                this.showCode = false
                this.getTimeNext();
            }
            else {
                this.$message.error(data.message)

            }
        },

        getTimeNext() {
            if (this.time > 0) {
                this.time = this.time - 1;
                setTimeout(() => {
                    this.getTimeNext();
                }, 1000)
            }
            else {
                this.showCode = true;
                this.time = 60
            }
        },
        setCheck() {
            this.haveCheck = true;
        },
        async toRegister() {
            if (this.active == 2) {
                let code = this.code
                let phone = this.phone

                let type = this.active
                let form = this.userForm;
                form.code = code;
                form.phone = phone
                this.loading = true;
                let data = await homeapi.registerUser(form);
                if (data.code == 200) {
                    this.$message.success("注册成功")
                    until.setCookie("token", data.result);
                    this.$router.push("/user")


                }
                else {
                    this.loading = false
                    this.$message.error(data.message)
                }
            }
            else {
                let code = this.code
                let phone = this.phone
                let type = this.active
                let form = this.form;
                form.code = code;
                form.phone = phone
                this.loading = true;
                let data = await homeapi.registerCompany(form);
                if (data.code == 200) {
                    this.$message.success("注册成功")
                    until.setCookie("token", data.result);
                    this.$router.push("/")



                }
                else {
                    this.loading = false
                    this.$message.error(data.message)
                }
            }

        },
        async getUserInfo() {
            let data = await homeapi.getUserinfo();
            if (data.code == 402) {

            }
            if (data.code == 403) {
                this.$router.push("/company")

            }
            if (data.code == 200) {

            }

        },

        async sureEdit() {
            if (this.active == 1) {
                let form = this.form;

                let data = await homeapi.editCompany(form);
                if (data.code == 200) {
                    this.loading = false
                    this.$message.success("注册成功")
                    this.$router.push("/")
                }
            }
            else {
                let form = this.form;

                let data = await homeapi.editUser(form);
                if (data.code == 200) {
                    this.loading = false
                    this.$message.success("注册成功")
                    this.$router.push("/")
                }
            }

        },
        changeWorkLink(item) {
            console.log(item)
            this.form.infoExperienceRequirements.item.map(res => {
                res.workLink = item
            })
        }


    }
}

</script>

<style src="@wangeditor/editor/dist/css/style.css"></style>
<style scoped lang="less">
.footer {
    position: fixed;
}

.container {
    width: 100%;
    height: calc(100vh - 125px);
    overflow: auto;
    margin-top: 15px;
}

.main-left {
    position: fixed;
    top: 95px;
    bottom: 30px;
    background: #fff;
}

.system-lt {
    border: 0px;
}

.system-rt {
    border: 0px;
}

.main-right {
    margin-left: 0px;
}

.navbar-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.navbar-header span {
    font-size: 24px;
    color: #FC7B24;
    font-weight: bold;
}

.upload_div {
    width: 80px;
    height: 80px;
    border: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.upload_div input {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload_div i {
    font-size: 18px;
}

.add_list {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 10px;
}

.add_btn {
    width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333333;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

.addmain {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.register-tag {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.rule_content {
    width: 500px;
    display: inline-block;
}

.register-form-label {
    width: 32%;
}

.right_div {
    float: right;
}

.register-tag::before {
    display: none;
}

.register-tag::after {
    display: none;
}

.right_div {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
</style>
